package zgs;

import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class Test03 {
    public static void main(String[] args) {
        File file = new File(".");
        File[] subs = file.listFiles();
        for (File sub : subs) {
            if(sub.isFile()&&sub.getName().endsWith(".obj")){
                try(
                        FileInputStream fis = new FileInputStream(sub);
                        ObjectInputStream ois = new ObjectInputStream(fis);
                ){
                    Object obj = ois.readObject();
                    if(obj instanceof User){
                        System.out.println(obj);
                    }


                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
